home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / rwini / rwini.frm < prev    next >
Text File  |  1995-05-02  |  7KB  |  254 lines

  1. VERSION 2.00
  2. Begin Form frmINI 
  3.    BackColor       =   &H00C0C0C0&
  4.    Caption         =   "Read-Write INI Sample"
  5.    ClientHeight    =   3240
  6.    ClientLeft      =   1155
  7.    ClientTop       =   2190
  8.    ClientWidth     =   7740
  9.    Height          =   3645
  10.    Icon            =   RWINI.FRX:0000
  11.    Left            =   1095
  12.    LinkTopic       =   "Form1"
  13.    ScaleHeight     =   3240
  14.    ScaleWidth      =   7740
  15.    Top             =   1845
  16.    Width           =   7860
  17.    Begin CommandButton Command12 
  18.       Caption         =   "Exit"
  19.       Height          =   495
  20.       Left            =   3120
  21.       TabIndex        =   15
  22.       Top             =   2520
  23.       Width           =   1215
  24.    End
  25.    Begin TextBox Text4 
  26.       Height          =   285
  27.       Left            =   1800
  28.       TabIndex        =   3
  29.       Top             =   1320
  30.       Width           =   1935
  31.    End
  32.    Begin CommandButton Command11 
  33.       Caption         =   "Read Phone"
  34.       Height          =   255
  35.       Left            =   3960
  36.       TabIndex        =   10
  37.       Top             =   1320
  38.       Width           =   1575
  39.    End
  40.    Begin CommandButton Command10 
  41.       Caption         =   "Write Phone"
  42.       Height          =   255
  43.       Left            =   5640
  44.       TabIndex        =   11
  45.       Top             =   1320
  46.       Width           =   1575
  47.    End
  48.    Begin CommandButton Command9 
  49.       Caption         =   "Clear All"
  50.       Height          =   495
  51.       Left            =   4440
  52.       TabIndex        =   14
  53.       Top             =   1920
  54.       Width           =   1215
  55.    End
  56.    Begin CommandButton Command8 
  57.       Caption         =   "Write All"
  58.       Height          =   495
  59.       Left            =   3120
  60.       TabIndex        =   13
  61.       Top             =   1920
  62.       Width           =   1215
  63.    End
  64.    Begin CommandButton Command7 
  65.       Caption         =   "Read All"
  66.       Height          =   495
  67.       Left            =   1800
  68.       TabIndex        =   12
  69.       Top             =   1920
  70.       Width           =   1215
  71.    End
  72.    Begin CommandButton Command6 
  73.       Caption         =   "Write Company"
  74.       Height          =   255
  75.       Left            =   5640
  76.       TabIndex        =   9
  77.       Top             =   960
  78.       Width           =   1575
  79.    End
  80.    Begin CommandButton Command5 
  81.       Caption         =   "Write Name"
  82.       Height          =   255
  83.       Left            =   5640
  84.       TabIndex        =   7
  85.       Top             =   600
  86.       Width           =   1575
  87.    End
  88.    Begin CommandButton Command4 
  89.       Caption         =   "Write Serial"
  90.       Height          =   255
  91.       Left            =   5640
  92.       TabIndex        =   5
  93.       Top             =   240
  94.       Width           =   1575
  95.    End
  96.    Begin CommandButton Command3 
  97.       Caption         =   "Read Company"
  98.       Height          =   255
  99.       Left            =   3960
  100.       TabIndex        =   8
  101.       Top             =   960
  102.       Width           =   1575
  103.    End
  104.    Begin CommandButton Command2 
  105.       Caption         =   "Read Name"
  106.       Height          =   255
  107.       Left            =   3960
  108.       TabIndex        =   6
  109.       Top             =   600
  110.       Width           =   1575
  111.    End
  112.    Begin TextBox Text3 
  113.       Height          =   285
  114.       Left            =   1800
  115.       TabIndex        =   2
  116.       Top             =   960
  117.       Width           =   1935
  118.    End
  119.    Begin TextBox Text2 
  120.       Height          =   285
  121.       Left            =   1800
  122.       TabIndex        =   1
  123.       Top             =   600
  124.       Width           =   1935
  125.    End
  126.    Begin CommandButton Command1 
  127.       Caption         =   "Read Serial"
  128.       Height          =   255
  129.       Left            =   3960
  130.       TabIndex        =   4
  131.       Top             =   240
  132.       Width           =   1575
  133.    End
  134.    Begin TextBox Text1 
  135.       Height          =   285
  136.       Left            =   1800
  137.       TabIndex        =   0
  138.       Top             =   240
  139.       Width           =   1935
  140.    End
  141.    Begin Label Label4 
  142.       Alignment       =   1  'Right Justify
  143.       BackColor       =   &H00C0C0C0&
  144.       Caption         =   "Phone:"
  145.       Height          =   255
  146.       Left            =   480
  147.       TabIndex        =   19
  148.       Top             =   1320
  149.       Width           =   1215
  150.    End
  151.    Begin Label Label3 
  152.       Alignment       =   1  'Right Justify
  153.       BackColor       =   &H00C0C0C0&
  154.       Caption         =   "Company:"
  155.       Height          =   255
  156.       Left            =   480
  157.       TabIndex        =   18
  158.       Top             =   960
  159.       Width           =   1215
  160.    End
  161.    Begin Label Label2 
  162.       Alignment       =   1  'Right Justify
  163.       BackColor       =   &H00C0C0C0&
  164.       Caption         =   "Name:"
  165.       Height          =   255
  166.       Left            =   1080
  167.       TabIndex        =   17
  168.       Top             =   600
  169.       Width           =   615
  170.    End
  171.    Begin Label Label1 
  172.       Alignment       =   1  'Right Justify
  173.       BackColor       =   &H00C0C0C0&
  174.       Caption         =   "Serial Number:"
  175.       Height          =   255
  176.       Left            =   360
  177.       TabIndex        =   16
  178.       Top             =   240
  179.       Width           =   1335
  180.    End
  181. End
  182. Option Explicit
  183.  
  184. Sub Command1_Click ()
  185.     text1.Text = GetFromINI("Serial", "SerialNumber", inipath$)
  186. End Sub
  187.  
  188. Sub Command10_Click ()
  189.     entry$ = text4.Text
  190.     r% = WritePrivateProfileString("UserInfo", "Phone", entry$, inipath$)
  191.     If r% <> 1 Then MsgBox "An error occurred while writing Phone."
  192. End Sub
  193.  
  194. Sub Command11_Click ()
  195.     text4.Text = GetFromINI("UserInfo", "Phone", inipath$)
  196. End Sub
  197.  
  198. Sub Command12_Click ()
  199.     End
  200. End Sub
  201.  
  202. Sub Command2_Click ()
  203.     text2.Text = GetFromINI("UserInfo", "Name", inipath$)
  204. End Sub
  205.  
  206. Sub Command3_Click ()
  207.     text3.Text = GetFromINI("UserInfo", "Company", inipath$)
  208. End Sub
  209.  
  210. Sub Command4_Click ()
  211.     entry$ = text1.Text
  212.     r% = WritePrivateProfileString("Serial", "SerialNumber", entry$, inipath$)
  213.     If r% <> 1 Then MsgBox "An error occurred while writing SerialNumber."
  214. End Sub
  215.  
  216. Sub Command5_Click ()
  217.     entry$ = text2.Text
  218.     r% = WritePrivateProfileString("UserInfo", "Name", entry$, inipath$)
  219.     If r% <> 1 Then MsgBox "An error occurred while writing Name."
  220. End Sub
  221.  
  222. Sub Command6_Click ()
  223.     entry$ = text3.Text
  224.     r% = WritePrivateProfileString("UserInfo", "Company", entry$, inipath$)
  225.     If r% <> 1 Then MsgBox "An error occurred while writing Company."
  226. End Sub
  227.  
  228. Sub Command7_Click ()
  229.     text1.Text = GetFromINI("Serial", "SerialNumber", inipath$)
  230.     text2.Text = GetFromINI("UserInfo", "Name", inipath$)
  231.     text3.Text = GetFromINI("UserInfo", "Company", inipath$)
  232.     text4.Text = GetFromINI("UserInfo", "Phone", inipath$)
  233. End Sub
  234.  
  235. Sub Command8_Click ()
  236.     Command4_Click
  237.     Command5_Click
  238.     Command6_Click
  239.     Command10_Click
  240. End Sub
  241.  
  242. Sub Command9_Click ()
  243.     text1.Text = ""
  244.     text2.Text = ""
  245.     text3.Text = ""
  246.     text4.Text = ""
  247. End Sub
  248.  
  249. Sub Form_Load ()
  250.     inipath$ = app.Path + "\rwini.ini"
  251.     Command7_Click
  252. End Sub
  253.  
  254.